Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use initComponent pattern #50

Merged
merged 1 commit into from
Mar 4, 2024
Merged

use initComponent pattern #50

merged 1 commit into from
Mar 4, 2024

Conversation

antonborisoff
Copy link
Owner

@antonborisoff antonborisoff commented Mar 4, 2024

  1. Define initComponent function that returns named harness (allows to use shorthand destructuring) and router (if needed); Keep in mind that INJET could only be called after configureTestingModule so injections should be done either in initComponent or after its call in a test;
  2. Initialize service spy objects in Jasmine beforeEach to make sure Jasmine handles thier lifecycle;
  3. In test: override/define spies, THEN call initComponent to finish GIVEN stage of the test;

initComponent allows more flexibility for component unit testing (different returned datasets, FTs, etc.)

Copy link

github-actions bot commented Mar 4, 2024

Code Coverage

Package Line Rate Branch Rate
app 100% 75%
app.components.contracts 100% 100%
app.components.home 100% 100%
app.components.login 100% 100%
app.components.not-found 100% 100%
app.guards 100% 94%
app.services.auth 100% 100%
app.services.contracts 100% 100%
app.services.features 100% 100%
app.services.message-box 100% 100%
app.tests 100% 100%
app.tests.foundation.tests 100% 100%
transloco 85% 100%
Summary 99% (154 / 156) 93% (28 / 30)

@antonborisoff antonborisoff merged commit efc1379 into master Mar 4, 2024
1 check passed
@antonborisoff antonborisoff deleted the initComponent-pattern branch March 4, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant